/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package cz.mzk.oai.repositoryManager.sets;

import cz.mzk.oai.repositoryManager.collections.CollectionEntity;
import cz.mzk.oai.repositoryManager.items.ItemEntity;
import java.io.Serializable;
import java.util.Set;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToMany;
import javax.persistence.OneToMany;

/**
 *
 * @author Martin Rehanek (rehan@mzk.cz)
 */
@Entity
public class SetEntity implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private String setSpec;
    private String setName;
    private String description;
    @ManyToMany
    private Set<ItemEntity> items;
    @OneToMany
    private Set<CollectionEntity> sets;

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final SetEntity other = (SetEntity) obj;
        if ((this.setSpec == null) ? (other.setSpec != null) : !this.setSpec.equals(other.setSpec)) {
            return false;
        }
        return true;
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 97 * hash + (this.setSpec != null ? this.setSpec.hashCode() : 0);
        return hash;
    }

    /**
     * @return the setSpec
     */
    public String getSetSpec() {
        return setSpec;
    }

    /**
     * @param setSpec the setSpec to set
     */
    public void setSetSpec(String setSpec) {
        this.setSpec = setSpec;
    }

    /**
     * @return the setName
     */
    public String getSetName() {
        return setName;
    }

    /**
     * @param setName the setName to set
     */
    public void setSetName(String setName) {
        this.setName = setName;
    }

    /**
     * @return the description
     */
    public String getDescription() {
        return description;
    }

    /**
     * @param description the description to set
     */
    public void setDescription(String description) {
        this.description = description;
    }

    /**
     * @return the items
     */
    public Set<ItemEntity> getItems() {
        return items;
    }

    /**
     * @param items the items to set
     */
    public void setItems(Set<ItemEntity> items) {
        this.items = items;
    }

    /**
     * @return the sets
     */
    public Set<CollectionEntity> getSets() {
        return sets;
    }

    /**
     * @param sets the sets to set
     */
    public void setSets(Set<CollectionEntity> sets) {
        this.sets = sets;
    }
}
